package book.items.item30;

// enum type with data and behavior
public enum Planet {
	MERCURY(3.302E+23, 2.439E6),
	VENUS  (4.869E+24, 6.052E6),
	EARTH  (5.975E+24, 6.378E6);
	
	// Universal gravitational constant
	private static final double G = 6.67300E-11;
	
	private final double mass;			// In kilograms
	private final double radius;			// In meters
	private final double surfaceGravity; 	// In m / s^2
	
	Planet(double mass, double radius) {
		this.mass = mass;
		this.radius = radius;
		surfaceGravity = G * mass /(radius * radius);
	}
	
	public double getMass() {
		return mass;
	}
	
	public double getRadius() {
		return radius;
	}
	
	public double getSurfaceGravity() {
		return surfaceGravity;
	}
	
	public double surfaceWight(double mass) {
		return mass * surfaceGravity; // F = m*a
	}
}
